package wang.app.demo.api.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Author dj.wang
 * @Date 2020/6/23 21:53
 * @Version V1.0
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BaseResponse<T>
{
    private int code;
    private String msg;
    private T data;

    public static <T> BaseResponse success()
    {
        return new BaseResponse<T>(0, "success", null);
    }

    public static <T> BaseResponse success(T data)
    {
        return new BaseResponse<T>(0, "success", data);
    }

    public static <T> BaseResponse fail(String msg)
    {
        return new BaseResponse(1, msg, null);
    }

}
